home *** CD-ROM | disk | FTP | other *** search
- Path: habs.ee.ubc.ca!not-for-mail
- From: ellenh@ee.ubc.ca (Ellen Ho)
- Newsgroups: comp.lang.c
- Subject: How to make this code portable?
- Date: 1 Mar 1996 20:54:11 -0800
- Organization: University of BC, Dept. of Electrical Engineering
- Message-ID: <4h8k9j$78r@habs.ee.ubc.ca>
- NNTP-Posting-Host: habs.ee.ubc.ca
-
- I am writing a program that I want to compile and run on both a Sun
- Sparcstation and a PC running OS/2 Warp. On the Sun, I compile the .c
- files with gcc. On the PC, I am using Visual Age.
-
- The program acceptes a list of filenames as command line
- arguments and does some processing with the list of files.
- On the Sun, I specify
-
- program *.txt
-
- and the shell will expand the wildcard into the names of all .txt
- files in the current working directory. So with a for loop in
- my C program I can go through each file and process the data.
-
- However, on the PC, "*.txt" is passed into my program as
- command line argument as is. This means that I may have to
- put in extra operating system dependent logic to expand the wildcard
- inside my program.
-
- Are there other ways to handle this?
-
- --
- Ellen Ho
- ellenh@ee.ubc.ca
-